package peace.grapher.chart
{
import flash.geom.Point;

import peace.grapher.CoordinatePlane;
/**
 * Примитивная кривая
 * 
 * @author peace
 * 
 */	
public class Curve extends Chart
{
	/**
	 * 
	 * @param plane
	 * @param points
	 * @param color
	 * @param thickness
	 * @param alpha
	 * 
	 */
	public function Curve (plane:CoordinatePlane = null, points:Array = null,
							color:int = 0, thickness:int = 1, alpha:Number = 1)
	{
		super(plane, points, color, thickness, alpha);
	}
	/**
	 * 
	 * @param points
	 * 
	 */	
	override public function redraw (points:Array = null):void
	{
		with (graphics)
		{
			clear();
			lineStyle(thickness, color, alpha_);
		}
		
		if (!points) points = this.points;
		
		if (points.length == 0) return;

		var p:Point;
		var i:int;
		for (i = 0; i < points.length; i++)
		{
			p = plane.getGlobalPoint(points[i]);
			if (i == 0)	graphics.moveTo (p.x, p.y);
			else graphics.lineTo(p.x, p.y);
		}
	}

}
}